/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package marsaMaroc.dao;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;

/**
 *
 * @author salah
 */
public class AdminDAO {

    EntityManagerFactory emf = Persistence.createEntityManagerFactory("Marsa-MarocPU");
    EntityManager em;

    public int getClientCount() {
        em = emf.createEntityManager();
        Query q = em.createQuery("select c from Client c");
        int nb = q.getResultList().size();
        return nb;
    }

    public int getFactureCount() {
        em = emf.createEntityManager();
        Query q = em.createQuery("select c from Facture c");
        int nb = q.getResultList().size();
        return nb;
    }

    public int getReclamationCount() {
        em = emf.createEntityManager();
        Query q = em.createQuery("select c from Reclamation c");
        int nb = q.getResultList().size();
        return nb;
    }

}
